# Maintainer: Caleb Connolly <caleb.connolly@linaro.org>
pkgname=cdba
pkgver=1.0
pkgrel=2
pkgdesc="Tool for remote board access"
url="https://github.com/linux-msm/cdba"
arch="all"
license="BSD-3-Clause"
subpackages="$pkgname-server"
makedepends="
	eudev-dev
	linux-headers
	libftdi1-dev
	libgpiod-dev
	meson
	yaml-dev
"
source="
	cdba-v$pkgver.tar.gz::https://github.com/linux-msm/cdba/archive/v$pkgver.tar.gz
"
options="!check"

build() {
	abuild-meson . output \
		-Dserver=enabled
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

server() {
	amove usr/bin/cdba-server

	install -Dm644 "$builddir"/shell/README -t \
		"$subpkgdir"/usr/share/cdba/shell
	install -Dm644 "$builddir"/shell/cdba-shell -t \
		"$subpkgdir"/usr/share/cdba/shell
	install -Dm644 "$builddir"/shell/post-receive -t \
		"$subpkgdir"/usr/share/cdba/shell
	install -Dm644 "$builddir"/shell/setup.sh -t \
		"$subpkgdir"/usr/share/cdba/shell
	install -Dm644 "$builddir"/shell/update -t \
		"$subpkgdir"/usr/share/cdba/shell
}

sha512sums="
c543034f65e66c59c36f69740478c24502f2c3dbf4d4660cf37a0d06158395030147b923a35f055842358886bee7d2e6369105e67c0032b50e970aa1ff45db16  cdba-v1.0.tar.gz
"
